<?php
class ItemRow extends Zend_Db_Table_Row_Abstract
{
    public function getDkpPrice()
    {
        if ($this->class == 4) {    
            
            // Armor
            switch ($this->slot) {
                case 1:  $factor = 1.00; break; // Head
                case 2:  $factor = 0.55; break; // Neck
                case 3:  $factor = 0.78; break; // Shoulder
                case 5:  $factor = 1.00; break; // Chest
                case 6:  $factor = 0.78; break; // Belt
                case 7:  $factor = 1.00; break; // Legs
                case 8:  $factor = 0.78; break; // Feet
                case 9:  $factor = 0.55; break; // Wrist
                case 10: $factor = 0.78; break; // Gloves
                case 11: $factor = 0.55; break; // Finger
                case 12: $factor = 0.55; break; // Finger
                case 13: $factor = 0.70; break; // Trinket
                case 14: $factor = 0.70; break; // Trinket
                case 15: $factor = 0.55; break; // Back
                case 23: $factor = 0.55; break; // Off-hand
                case 28: $factor = 0.42; break; // Idol, relic, sigil, totem
                default: $factor = 0.00; break; // Something else...
            }
             
        } else if ($this->class == 2) { 
            
            // Weapon
            switch ($this->subclass) {
                case 15:  $factor = 0.55; break; // Daggers
                case 13:  $factor = 0.55; break; // Fist Weapons
                case  0:  $factor = 0.55; break; // One-Handed Axes
                case  4:  $factor = 0.55; break; // One-Handed Maces
                case  7:  $factor = 0.55; break; // One-Handed Swords
                case  6:  $factor = 1.00; break; // Polearms
                case 10:  $factor = 1.00; break; // Staves
                case  1:  $factor = 1.00; break; // Two-Handed Axes
                case  5:  $factor = 1.00; break; // Two-Handed Maces
                case  8:  $factor = 1.00; break; // Two-Handed Swords
                case  2:  $factor = 0.42; break; // Bows
                case 18:  $factor = 0.42; break; // Crossbows
                case  3:  $factor = 0.42; break; // Guns
                case 16:  $factor = 0.42; break; // Thrown
                case 19:  $factor = 0.42; break; // Wands
                case 20:  $factor = 0.00; break; // Fishing Poles
                default:  $factor = 0.00; break; // Hmm...
            }
            
        } else {
            
            // Everything else
            $factor = 0.00;
        }
        
        return max($this->level - 185, 0) * 0.40 * $factor;
    }
}
?>